<template>
	<view class="container">
		<!-- 轮播图区域 -->
		<swiper :indicator-dots="true" :autoplay="true" :interval="3000" :duration="1000" circular="true">
			<swiper-item>
				<navigator class="swiper-item" url="/otherpkg/introduction/introduction">
					<image src="/static/other_icons/index-1.png"></image>
				</navigator>
			</swiper-item>
			<swiper-item v-for="(item,i) in swiperList" :key="i">
				<navigator class="swiper-item" :url="url">
					<image src="item.image_src"></image>
				</navigator>
			</swiper-item>
		</swiper>
		<!-- 子导航区域 -->
		<view class="nav-list">
			<view class="nav-item" @click="bindHouse()">
				<image src="/static/nav_icons/nav-bind.png" class="nav-img"></image>
				<text>芯房绑定</text>
			</view>
			<view class="nav-item" @click="bindProgress()">
				<image src="/static/nav_icons/nav-pro.png" class="nav-img"></image>
				<text>芯房进度</text>
			</view>
			<view class="nav-item">
				<image src="/static/nav_icons/nav-quality.png" class="nav-img"></image>
				<text>芯房品质</text>
			</view>
		</view>
		<advanced-lable src="/static/lable_icons/watch-house.png" ismore="true" content="芯房鉴赏" @skiptolist="skipToList" />
		<scroll-view class="scroll-view" scroll-x="true" @scroll="scroll" scroll-left="120">
			<houses-list-item class="house-item"></houses-list-item>
			<houses-list-item class="house-iten"></houses-list-item>
		</scroll-view>
		<advanced-lable src="/static/lable_icons/star.png" content="芯房动态"></advanced-lable>
		<view class="dynamic-list">
			<dynamic-info-card></dynamic-info-card>
			<dynamic-info-card></dynamic-info-card>
			<dynamic-info-card></dynamic-info-card>
			<dynamic-info-card></dynamic-info-card>
			<dynamic-info-card></dynamic-info-card>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				swiperList: [],
			};
		},
		onLoad() {
			this.getSwiperList();
			this.init()
		},
		methods: {
			init() {
				const realTimeInfo = {}
				realTimeInfo.pageNum = 1
				realTimeInfo.pageSize = 10
				realTimeInfo.queryBean = {}
				this.fetchRealTimeInfo(realTimeInfo)
			},
			async getSwiperList() {
				const {
					data: res
				} = await uni.$http.get("url")
				if (res.meta.status !== 200) {
					return uni.showMsg()
				}
				this.swiperList = res.message
			},
			goTo(url) {
				uni.navigateTo({
					url: url
				})
			},
			bindProgress() {
				this.goTo('/minepkg/progress_detail/progress_detail')
			},
			scroll: function(e) {
				console.log(e)
				this.old.scrollTop = e.detail.scrollTop
			},

			skipToList() {
				const fakeData = {}
				fakeData.pageNum = 1
				fakeData.pageSize = 10
				fakeData.queryBean = {}
				// console.log(uni.getStorageSync('authCode'))

				//获取资讯列表
				this.fetchData(fakeData)

				this.goTo('/subpkg/house_list/house_list')
			},
			async fetchData(form) {
				const {
					data: res
				} = await uni.$http.post(uni.$http.baseURL + '/estateManage/getBusinessRealEstateList',
					form);
				console.log(res.body.data)

			},
			async fetchRealTimeInfo(form) {
				const {
					data: res
				} = await uni.$http.post(uni.$http.baseURL + '/realTimeInfo/realTimeInfoList',
					form);
				console.log(res.body.data)
			},
			bindHouse() {
				this.goTo('/subpkg/create_house/create_house')
			}
		}
	}
</script>

<style lang="scss" scoped>
	.container {
		padding: 20rpx 30rpx 30rpx 30rpx;
	}

	swiper {
		width: 690rpx;
		height: 340rpx;
		margin-bottom: 30rpx;
		border: 1rpx solid #efefef;

		.swiper-item,
		image {
			width: 690rpx;
			height: 340rpx;
		}
	}

	.nav-list {
		background: #FFFFFF;
		display: flex;
		justify-content: space-around;
		margin: 30rpx 0;
		border-radius: 20rpx;
		border: 1rpx solid #efefef;

		.nav-item {
			display: flex;
			flex-direction: column;
			align-items: center;

			.nav-img {
				margin: 36rpx 55rpx 20rpx 55rpx;
				width: 120rpx;
				height: 120rpx;
			}

			text {
				font-size: 28rpx;
				margin-bottom: 37rpx;
			}
		}

	}

	.scroll-view {
		margin-top: 20rpx;
		height: 240rpx;
		margin-bottom: 32rpx;
		// display: flex;
		// flex-direction: row;
		// justify-content: flex-start;
		// flex-wrap: wrap;


		.house-item {
			width: 620rpx;
		}
	}

	.dynamic-list {
		border: 1rpx solid #efefef;
		height: 720rpx;
		margin-top: 20rpx;
		background-color: #FFFFFF;
		border-radius: 20rpx;
	}
</style>
